package com.alibaba.cirtus.ots.application.adapter.ability.model.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * 发票类型相关枚举
 */
public enum InvoiceOrderTypeEnum {

    F1("F1", "发票(F1)"),

    F2("F2", "发票"),

    G2("G2", "贷项凭证"),

    G2S("G2S", "第三方信贷凭证"),

    IG("IG", "内部贷项凭证"),

    IGS("IGS", "取消IG"),

    IV("IV", "公司间出具发票（销售订单)"),

    IVA("IVA", " IB订单相关的"),

    IVS("IVS", "取消IV"),

    L2("L2", "借项凭单"),

    LG("LG", "贷项凭单清单"),

    LGS("LGS", "取消贷项凭证清单"),

    LR("LR", "发票清单"),

    LRS("LRS", "取消发票清单"),

    RE("RE", "退货货记"),

    S1("S1", "取消发票(S1)"),

    S2("S2", "取消贷项凭证"),

    S3("S3", "取消发票(S3)"),

    SHR("SHR", "取消培训管理"),

    SV("SV", "取消现金订单"),

    WIA("WIA", "海外工厂"),

    ZBV("ZBV", "发票(销售公司）"),

    ZF2("ZF2", "发票(销售公司）"),

    ZF3("ZF3", "发票(销售公司）"),

    ZF31("ZF31", "销售公司兑换实物销售发票"),

    ZF4("ZF4", "免费发票(销售公司）"),

    ZFRE("ZFRE", "免费订单退货（销售公司）"),

    ZIG("ZIG", "内部贷项凭证（调拨单）"),

    ZIGS("ZIGS", "取消ZIG"),

    ZIV("ZIV", "公司间出具发票（调拨单）"),

    ZIVS("ZIVS", "取消ZIV"),

    ZRE("ZRE", "退货贷记（销售公司）"),

    ZS1("ZS1", "取消发票(S1)"),

    ZS2("ZS2", "取消贷项凭证");

    InvoiceOrderTypeEnum(String code, String desc) {
        code = code;
        desc = desc;
    }

    /**
     * 编码
     */
    @Getter
    private String code;
    /**
     * 描述
     */
    @Getter
    private String desc;

    public static InvoiceOrderTypeEnum of(String code) {
        return Arrays.stream(InvoiceOrderTypeEnum.values()).filter(invoiceOrderTypeEnum -> invoiceOrderTypeEnum.equals(code)).findFirst().orElse(null);
    }
}
